using IcsSEMCtrl.Util;
namespace Lifter.Global.Device
{
    public class TransferCommandType
    {
        public const int _TRANSFER = 0;
        public const int _CANCEL = 1;
        public const int _ABORT = 2;
        private int _value;
        private static int _size;
        private static TransferCommandType[] _array;
        public static string[] displayStrings;
        public static TransferCommandType[] displayValues;
        public static TransferCommandType TRANSFER;
        public static TransferCommandType CANCEL;
        public static TransferCommandType ABORT;
        public static TransferCommandType IT_ENUM_MAX;
        static TransferCommandType()
        {
            TransferCommandType._size = 3;
            TransferCommandType._array = new TransferCommandType[TransferCommandType._size];
            TransferCommandType.displayStrings = new string[TransferCommandType._size];
            TransferCommandType.displayValues = new TransferCommandType[TransferCommandType._size];
            TransferCommandType.TRANSFER = new TransferCommandType(0);
            TransferCommandType.CANCEL = new TransferCommandType(1);
            TransferCommandType.ABORT = new TransferCommandType(2);
            TransferCommandType.IT_ENUM_MAX = new TransferCommandType(2147483647);
            TransferCommandType.displayStrings[0] = "TRANSFER";
            TransferCommandType.displayStrings[1] = "CANCEL";
            TransferCommandType.displayStrings[2] = "ABORT";
            TransferCommandType.displayValues[0] = TransferCommandType.TRANSFER;
            TransferCommandType.displayValues[1] = TransferCommandType.CANCEL;
            TransferCommandType.displayValues[2] = TransferCommandType.ABORT;
        }
        public static string ValueToString(TransferCommandType val)
        {
            string result;
            if (val != null)
            {
                switch (val.Value())
                {
                    case 0:
                        result = TransferCommandType.displayStrings[0];
                        break;
                    case 1:
                        result = TransferCommandType.displayStrings[1];
                        break;
                    case 2:
                        result = TransferCommandType.displayStrings[2];
                        break;
                    default:
                        result = "";
                        break;
                }
            }
            else
            {
                result = "";
            }
            return result;
        }
        public static TransferCommandType StringToValue(string val)
        {
            TransferCommandType result;
            if (Helper.IsNullOrEmpty(val))
            {
                result = TransferCommandType.IT_ENUM_MAX;
            }
            else
            {
                for (int i = 0; i < TransferCommandType.displayStrings.Length; i++)
                {
                    if (val.Equals(TransferCommandType.displayStrings[i]))
                    {
                        result = TransferCommandType.displayValues[i];
                        return result;
                    }
                }
                result = null;
            }
            return result;
        }
        public int Value()
        {
            return this._value;
        }
        public static TransferCommandType From_Int(int value)
        {
            TransferCommandType result;
            if (value >= 0 && value < TransferCommandType._size)
            {
                result = TransferCommandType._array[value];
            }
            else
            {
                result = TransferCommandType.IT_ENUM_MAX;
            }
            return result;
        }
        protected TransferCommandType(int value)
        {
            this._value = value;
            if (value >= 0 && value < TransferCommandType._size)
            {
                TransferCommandType._array[this._value] = this;
            }
        }
        public bool Equals(TransferCommandType otherEnum)
        {
            return otherEnum.Value() == this._value;
        }
        public override string ToString()
        {
            return TransferCommandType.displayStrings[this._value];
        }
    }
}
